import Mock from 'mockjs'

// 模拟菜单数据
const menuList = [
  {
    id: '1',
    parentId: '0',
    title: '系统管理',
    icon: 'Setting',
    path: '/system',
    sort: 1,
    status: '1',
    children: [
      {
        id: '11',
        parentId: '1',
        title: '菜单管理',
        icon: 'Menu',
        path: '/system/menu',
        sort: 1,
        status: '1'
      }
    ]
  }
]

// Mock接口
Mock.mock('/api/menu/list', 'get', {
  code: 200,
  message: 'success',
  data: menuList
})

Mock.mock('/api/menu/save', 'post', ({ body }) => {
  const menu = JSON.parse(body)
  return {
    code: 200,
    message: 'success',
    data: menu
  }
})

Mock.mock(/\/api\/menu\/delete\/\d+/, 'delete', {
  code: 200,
  message: 'success'
})